package com.trg.designmodel.prototype.copy;

/**
 * @ClassName: Client
 * @Description:
 * @Author: tangrg
 * @Date: 2021/7/2 10:50
 * @Version: 1.0
 * @Return:
 **/
public class Client {

    public static void main(String[] args) throws Exception{
        //深拷贝测试，测试结果，要求对象一致，但是hash值不能一样，则表示为深拷贝
        Schoole schoole = new Schoole("武汉大学", "珞喻路");
        schoole.setStudent(new Student("张三","185",25));

//        Schoole clone = (Schoole)schoole.clone();

//        System.out.println(schoole+"  hash="+schoole.hashCode());
//        System.out.println(clone+"  hash="+clone.hashCode());

        //方式二


        Schoole clone = schoole.deepCopy();

        System.out.println(schoole+"  hash="+schoole.hashCode());
        System.out.println(clone+"  hash="+clone.hashCode());

    }
}
